#ifndef REFERENCE_H
#define REFERENCE_H
#include "VariableWrapper.h"

enum REFERENCE_TYPE {
    POINTER,
    STRUCT,
    VARIABLE
};

class Reference {
    public:
        Reference(REFERENCE_TYPE set_type);
        //~Reference();
        void setChild(Reference *c) { child = c; }
        void setVar(VariableWrapper *set_var) { 
            this->var = set_var; 
            if(child != NULL) child->setVar(set_var);
        }
        VariableWrapper *getVar();
        Reference *getChild() { return child; }

        Reference *append(Reference *ref);
        int equals(Reference *other);

        int is_ptr() { return type == POINTER; }
        int is_struct() { return type == STRUCT; }
        int is_var() { return type == VARIABLE; }

        string full_str();
        Reference *copy();
        int equals_helper(Reference *ref);
        REFERENCE_TYPE getType() { return type; }
        void setField(string set_field) { field = set_field; }
        string getField() { return field; }
        int getOrder();
    private:
        string full_str_helper();
        VariableWrapper *var;
        Reference *child;
        REFERENCE_TYPE type;
        string field;
};



#endif
